home *** CD-ROM | disk | FTP | other *** search
/ The X-Philes (2nd Revision) / The X-Philes Number 1 (1995).iso / xphiles / coding / 80x86 / code32.lzh / EXAMPLE2.ASM < prev    next >
Assembly Source File  |  1993-01-09  |  2KB  |  68 lines

  1.  
  2. ; This program prints the raw keyboard data that it gets. Press ESC to quit.
  3. ;
  4. ; Link this program with KB32.
  5.  
  6.         .386p
  7.         jumps
  8. code32  segment para public use32
  9.         assume cs:code32, ds:code32, ss:code32
  10.  
  11. include start32.inc
  12. include kb32.inc
  13.  
  14. public  _main
  15.  
  16. ;▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒
  17. ; DATA
  18. ;▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒
  19. done            db      0               ; done flag
  20.  
  21. ;▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒
  22. ; CODE
  23. ;▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒
  24.  
  25. ;═════════════════════════════════════════════════════════════════════════════
  26. _main:
  27.         @rlp edi,0b8000h                ; clear screen
  28.         mov eax,7200720h
  29.         mov ecx,(80*25)/2
  30.         rep stosd
  31.  
  32.         call _init_kb                   ; initialize KB driver
  33.         mov _kbhand,offset kbh
  34.  
  35. delay:                                  ; wait till done flag is set
  36.         cmp done,1
  37.         jne delay
  38.  
  39.         call _reset_kb
  40.         jmp _exit
  41.  
  42. ;─────────────────────────────────────────────────────────────────────────────
  43. kbh:
  44.         cmp al,1                        ; is it ESC
  45.         jne short kbhf0
  46.  
  47.         mov done,1                      ; set done flag
  48.         ret
  49.  
  50. kbhf0:
  51.         @rlp edi,0b8000h                ; put code to screen buffer
  52.         mov ebx,offset _hextbl
  53.         mov ah,0fh
  54.         mov dl,al
  55.         shr al,4
  56.         xlat
  57.         stosw
  58.         mov al,dl
  59.         and al,0fh
  60.         xlat
  61.         stosw
  62.         ret
  63.  
  64.  
  65. code32  ends
  66.         end
  67.  
  68.